package com.x.reader.service;

import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import com.x.reader.dao.HistoryDao;
import com.x.reader.model.History;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class HistoryService extends BaseService {

    @Autowired
    private HistoryDao historyDao;

    public History insertHistory(History history) {
        try {
            return this.insert(history);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
        }
    }

    public List<History> selectHistoryList(History history) {
        try {
            return historyDao.selectHistoryList(history);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
        }
    }

}
